"""
专旺格五种：
    曲直格
    炎上格
    稼穑格
    从革格
    润下格
"""
def wang_mu(mp):
    """
    曲直格
    """
    zhis = [zhu[1].zhi.name for zhu in mp.sizhu]
    cond1 = mp.riyuan.gan.name in '甲乙'
    cond2 = mp.yueling.zhi.name in '寅卯辰'
    cond3 = all([x in zhis for x in '寅卯辰']) or all([x in zhis for x in '亥卯未'])
    cond4 = not any([x in zhis for x in '庚辛申酉'])
    return cond1 and cond2 and cond3 and cond4


def wang_huo(mp):
    """
    炎上格
    """
    zhis = [zhu[1].zhi.name for zhu in mp.sizhu]
    cond1 = mp.riyuan.gan.name in '丙丁'
    cond2 = mp.yueling.zhi.name in '巳午未'
    cond3 = all([x in zhis for x in '巳午未']) or all([x in zhis for x in '寅午戌'])
    cond4 = not any([x in zhis for x in '壬癸亥子']) or \
            not any([x in zhis for x in '壬亥子']) and all([x in zhis for x in '癸戊'])
    return cond1 and cond2 and cond3 and cond4


def wang_tu(mp):
    """
    稼穑格
    """
    zhis = [zhu[1].zhi.name for zhu in mp.sizhu]
    cond1 = mp.riyuan.gan.name in '戊己'
    cond2 = mp.yueling.zhi.name in '辰戌丑未'
    cond3 = all([zhu[1].zhi.wuxing.name == '土' for zhu in mp.sizhu])
    cond4 = not any([x in zhis for x in '甲乙寅卯'])
    return cond1 and cond2 and cond3 and cond4


def wang_jin(mp):
    """
    从革格
    """
    zhis = [zhu[1].zhi.name for zhu in mp.sizhu]
    cond1 = mp.riyuan.gan.name in '庚辛'
    cond2 = mp.yueling.zhi.name in '申酉戌'
    cond3 = all([x in zhis for x in '申酉戌']) or all([x in zhis for x in '巳酉丑'])
    cond4 = not any([x in zhis for x in '丙丁午未'])
    return cond1 and cond2 and cond3 and cond4


def wang_shui(mp):
    """
    润下格
    """
    zhis = [zhu[1].zhi.name for zhu in mp.sizhu]
    cond1 = mp.riyuan.gan.name in '壬癸'
    cond2 = mp.yueling.zhi.name in '亥子丑'
    cond3 = all([x in zhis for x in '亥子丑']) or all([x in zhis for x in '申子辰'])
    cond4 = not any([x in zhis for x in '戊己未戌'])
    return cond1 and cond2 and cond3 and cond4
